package ControllerLayer;
import ContainerLayer.*;
import java.util.ArrayList;

/**
 * Write a description of class CostumerController here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class CostumerController
{
    // instance variables - replace the example below with your own
    private CostumerContainer coCon;
    private static CostumerController instance;    
    private long id;

    /**
     * Constructor for objects of class CostumerController
     */
    private CostumerController()
    {
        // initialise instance variables
        this.id = 0;          
        coCon = CostumerContainer.getInstance();
    }

    public static CostumerController getInstance()
    {
        if(instance == null)
        {
            instance = new CostumerController();
        }
        return instance;
    }

    public long getID()
    {
        return id;
    }

    public int getSize()
    {
        return coCon.getSizeCostumer(); 
    }

    
    public void createCostumer(String name, String address, String mail, int phoneNo)
    {
        id++;
        Costumer co = new Costumer(id, name, address, mail, phoneNo);
        coCon.addCostumer(co);
    }

    public Costumer readCostumer(long id)
    {
        return coCon.readCostumer(id);    
    }

    public void updateCostumer(long id, String name, String address, String mail, int phoneNo)
    {
        coCon.updateCostumer(id, name, address, mail, phoneNo);
    }

    public void deleteCostumer(long id)
    {        
        coCon.deleteCotumer(id);
    }

    public void printOutCostumerID(long id)
    {
        coCon.printOutCostumerID(id);
    }

    public void printOutAllCostumer()
    {
        coCon.printOutAllCostumer();
    }

    
}
